{{ await Mode("TPL").Render("@"+KUO.CLASS+"/"+TPLtemp+"/head",KUO,THIS) }}
<div class="kuoUseR">
  <div class="layui-container">
    <div class="usertoubu">
        <img src="{{CDNHOST}}Tpl/cms/manhua/image/user.png" id="ulogo" class="image"></img>
        <p class="lijiden"  id="uname"> <b onclick="CaiDan('login')"> 立即登陆</b></p>
    </div>
    <div class="usercaidan">

      <div class="layui-row layui-col-space20 ">
        <div class="layui-col-md3 layui-col-xs3" onclick="CaiDan('money')">
            <i class="layui-icon layui-icon-rmb color0"></i>   
            <p id="ujine">0.00<p>
        </div>
        <div class="layui-col-md3 layui-col-xs3 "  onclick="CaiDan('pay')">
          <i class="layui-icon layui-icon-vercode color1"></i>   
          <p>立即充值<p>
        </div>
        <div class="layui-col-md3  layui-col-xs3 " onclick="CaiDan('liulan')">
          <i class="layui-icon layui-icon-time color2"></i>   
          <p>浏览记录<p>
        </div>
        <div class="layui-col-md3 layui-col-xs3 " onclick="CaiDan('shoucang')">
          <i class="layui-icon layui-icon-rate-solid color1"></i>   
          <p>收藏记录<p>
        </div>
        <div class="layui-col-md3 layui-col-xs3 " onclick="CaiDan('xiugai')">
          <i class="layui-icon layui-icon-vercode color2"></i>   
          <p>修改密码<p>
        </div>

        <div class="layui-col-md3 layui-col-xs3 " onclick="CaiDan('kefu')">
          <i class="layui-icon layui-icon-service color1"></i>   
          <p>联系客服<p>
        </div>

        <div class="layui-col-md3 layui-col-xs3 " onclick="CaiDan('soso')">
          <i class="layui-icon layui-icon-delete color2"></i>   
          <p>搜索清理<p>
        </div>

        <div class="layui-col-md3 layui-col-xs3 color0" onclick="CaiDan('quite')">
          <i class="layui-icon layui-icon-close-fill"></i>   
          <p>退出登陆<p>
        </div>
      </div>

    </div>


  </div>
</div>
{{ await Mode("TPL").Render("@"+KUO.CLASS+"/"+TPLtemp+"/foot",KUO,THIS) }}
<script>
var height = 0;
var PAGE = 1;
var TOKEN = "";
function moneypage(mmm){
    PAGE +=mmm;
    if(PAGE <=1){
      PAGE = 1;
    }
    moneytiao();
};
function time(times){
  if(times < 1) return 'Unknown';
  var date = new Date(times*1000);
  return layui.util.toDateString(date, "yyyy-MM-dd HH:mm");
}
function qiandao(){
  apptongxin( "cms/json/money",{action:"qian",token:TOKEN},function(data){
    if(data.token && data.token != ""){
      TOKEN = data.token;
		} 
    moneytiao();
  });
};
function moneytiao(){ 
    apptongxin( "cms/json/money",{page:PAGE},function(data){
      if(data.token && data.token != ""){
        TOKEN = data.token;
	  	}
      if(data.code == 1){
        var list = data.data.list;
        var html_ = "";
      
        if(list.length < 1){
          PAGE --;
        }
        for(var m in list){
          html_+=`<div class="llllxx"><div class="biaoto">`+list[m]['typename']+`</div><div>`+time(list[m].time)+` <span class="jinexx" `+(list[m].num<0?'style="color:red" ':'')+`>`+(list[m].num> 0?'+'+list[m].num:list[m].num)+`</span></div></div>`;
        }
        html_ +=`<div class="layui-clear"></div><div style="padding:10px;">
          <button onclick="moneypage(-1)" class="layui-btn">上一页</button> `;
          if(data.data.task && data.data.task.qian == 1){
        html_ +=`<button onclick="qiandao()" class="layui-btn layui-btn-danger" style="margin-left:10%;">签到</button> `;
          }
        html_ +=` <button class="layui-btn  layui-btn-normal" onclick="moneypage(1)" style="float:right;">下一页</button> 
        </div>`;
        $("#neirongxx").html(html_);
      }
    });
  };
function money(){
  var html = `<div class="layui-container" style="padding:0px;"><div class="kuojinerizi" id="neirongxx">`;
  html += `</div></div>`;
  layer.open({
    title:"点卷中心",
    type: 1,
    skin: 'layui-layer-rim',
    area:['100%', '100%'],
    content: html,
    success: function(layero, index){
      moneytiao();
    }
  });
}
function liulanpage(mmm){
    PAGE +=mmm;
    if(PAGE <=1){
      PAGE = 1;
    }
    liulantiao();
};
function liulandel(id){

  apptongxin( "chapter/scan",{id:id},function(data){
    if(data.code == 1){
    $("#scanlist"+id).remove();
    layer.msg("删除成功");
    }else{
      layer.msg("删除失败");
    }
  });

}
function liulantiao(){ 

    apptongxin( "chapter/scan",{page:PAGE,type:0},function(data){


      if(data.code == 1){
        var list = data.data;
        var html_ = "";
      

        for(var m in list){
          html_ +=` <div class="layui-col-md4 layui-col-xs12 toplist" id="scanlist`+list[m].id+`">
        
        <div class="layui-row toplistone">
          <div class="layui-col-md4 layui-col-xs4">
            <a href="`+list[m].href+`" target="_blank"><img style="min-height:158px;" src="`+list[m].photo+`"  class="img"></img></a>
          </div>
          <div class="layui-col-md7 layui-col-xs7 yidongx">
            <h2><a href="`+list[m].href+`" target="_blank">`+list[m].name+`</a></h2>
            <p class="p desc"> <button class="layui-btn layui-btn-danger  layui-btn-xs" style="float:right;" onclick="liulandel(`+list[m].id+`)"> 删除</button> </p>
            <p class="cjyihang p">更至：<span class="span">`+list[m].newname+`</span></p>
            <p class="cjyihang p">`+(list[m].read!=''?'阅读：'+list[m].read:'')+`</p>
            <p class="cjyihang p"><a class="lijyueud" href="`+list[m].href+`" target="_blank">立即阅读</a></p>
          </div>
        </div>
      </div> `;

        }

        html_ +=`<div class="layui-clear"></div><div style="padding:10px;">
          <button onclick="liulanpage(-1)" class="layui-btn">上一页</button>  <button class="layui-btn  layui-btn-normal" onclick="liulanpage(1)" style="float:right;">下一页</button> 
        </div>`;
        $("#neirongxx").html(html_);
      }else{
        PAGE --;
      }

      layui.flow.lazyimg();
    });
  
}
function liulan(){
  var html = `<div class="kuotoplist"><div class="layui-container"><div class="layui-row layui-col-space20 tyoelist2" id="neirongxx">`;
  html += `</div></div></div>`;
  layer.open({
        title:"浏览记录",
        type: 1,
        skin: 'layui-layer-rim',
        area:['100%', '100%'],
        content: html,
       
        success: function(layero, index){
          liulantiao();
          
        }
    });
}
function shoucangdel(id){

apptongxin( "chapter/scan",{id:id,type:1},function(data){
  if(data.code == 1){
  $("#scanlist"+id).remove();
  layer.msg("删除成功");
  }else{
    layer.msg("删除失败");
  }
});

}
function shoucangpage(mmm){
  PAGE +=mmm;
    if(PAGE <=1){
      PAGE = 1;
    }
    shoucangtiao();

}
function shoucangtiao(){
  apptongxin( "chapter/scan",{page:PAGE,type:1},function(data){


  if(data.code == 1){
    var list = data.data;
    var html_ = "";


    for(var m in list){
      html_ +=` <div class="layui-col-md4 layui-col-xs12 toplist" id="scanlist`+list[m].id+`">
      
      <div class="layui-row toplistone">
        <div class="layui-col-md4 layui-col-xs4">
          <a href="`+list[m].href+`" target="_blank"><img style="min-height:158px;" src="`+list[m].photo+`"  class="img"></img></a>
        </div>
        <div class="layui-col-md7 layui-col-xs7 yidongx">
          <h2><a href="`+list[m].href+`" target="_blank">`+list[m].name+`</a></h2>
          <p class="p desc"> <button class="layui-btn layui-btn-danger  layui-btn-xs" style="float:right;"  onclick="shoucangdel(`+list[m].id+`)"> 删除</button> </p>
          <p class="cjyihang p">更至：<span class="span">`+list[m].newname+`</span></p>
          <p class="cjyihang p">`+(list[m].read!=''?'阅读：'+list[m].read:'')+`</p>
          <p class="cjyihang p"><a class="lijyueud" href="`+list[m].href+`" target="_blank">立即阅读</a></p>
        </div>
      </div>
    </div> `;

      }

      html_ +=`<div class="layui-clear"></div><div style="padding:10px;">
        <button onclick="shoucangpage(-1)" class="layui-btn">上一页</button>  <button class="layui-btn  layui-btn-normal" onclick="shoucangpage(1)" style="float:right;">下一页</button> 
      </div>`;
      $("#neirongxx").html(html_);
    }else{
      PAGE --;
    }

    layui.flow.lazyimg();
  });

}

function shoucang(){
  var html = `<div class="kuotoplist"><div class="layui-container"><div class="layui-row layui-col-space20 tyoelist2" id="neirongxx">`;
  

  html += `</div></div></div>`;
  layer.open({
        title:"收藏记录",
        type: 1,
        skin: 'layui-layer-rim',
        area:['100%', '100%'],
        content: html,
        
        success: function(layero, index){
          shoucangtiao();
        }
    });
}

function xiugai(){
  var html = `
    <form class="layui-form"  style="padding-top:20px;">
      
  
   <div class="layui-form-item">
    <label class="layui-form-label">原来密码</label>
    <div class="layui-input-block">
      <input type="password" name="findback"  placeholder="请输入原来密码" lay-verify="required" style="width:90%;" autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">新的密码</label>
    <div class="layui-input-block">
      <input type="text" name="password"  placeholder="请输入新的密码" lay-verify="required"  style="width:90%;" autocomplete="off" class="layui-input">
    </div>
  </div>
   <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="uxiugai">立即修改</button>
    </div>
  </div>
</form>
  `;
    layer.open({
        title:"<span style='color:red;'>修改登录密码</span>",
        type: 1,
        skin: 'layui-layer-rim',
        area: ['320px','250px'],
        offset:'200px',
        content: html,
        shadeClose: true,
        success: function(layero, index){
          layui.form.on('submit(uxiugai)', function(data){
            data.field.account = data.field.findback;
            apptongxin( "login/account_pass",data.field,function(data){
            
                if(data.code == 1){
                  layer.closeAll();
                }
                layer.msg(data.msg);
            }); 
            return false; 
          });
          layui.form.render();
        }
    });
}


function CaiDan(type){
  PAGE = 1;
  if(type == "login"){
    login(getUSer);
    return ;
  }
  if(UID < 1 && type != 'soso'){
    login(CaiDan,type);
    return ;
  }else if(type == 'xiugai'){
    xiugai();
    return ;
  }else if(type == 'pay'){
    pay();
    return ;
  }else if(type == 'kefu'){
    window.open('{{THIS.$WANGZHAN.link}}');
    return ;
  }else if(type == 'money'){
    money();
    return ;
  }else if(type == 'shoucang'){
    shoucang();
    return ;
  }else if(type == 'liulan'){
    liulan();
    return ;
  }else if(type == 'soso'){
    
    localStorage.removeItem("SOSO");
    layer.msg("清理成功");
    return ;
  }else if(type == 'quite'){
    apptongxin("login/quite",{},function(data){
        UID = 0;
        $("#ujine").html(0.00);
        $("#ulogo").attr({src:"{{CDNHOST}}Tpl/cms/manhua/image/user.png"});
        $("#uname").html(`<b onclick="CaiDan('login')"> 立即登陆</b>` );
    });
  }
}

function getUSer(){
  apptongxin("cms/json/getuid",{},function(data){
    if(data && data.code ==1){
      if(data.data.id){
        var User = data.data;
        
        JINE = data.data.money;
        UID = data.data.id;
        $("#ujine").html(JINE);
        $("#ulogo").attr({src:User.avatar});
        $("#uname").html(User.nickname);
      }
    }
  });
}

$(function(){
  layui.flow.lazyimg();
  getUSer();
});
</script>